<!-- $Id: warehouse_info.htm 14216 2008-03-10 02:27:21Z testyang $ -->
{include file="pageheader_bd.htm"}
{insert_scripts files="../js/utils.js,selectzone_bd.js,validator.js"}

<script type="text/javascript" src="js/rg_area.js"></script>
<link rel="stylesheet" type="text/css" href="../js/dialog.css">
<script type="text/javascript" src="../js/dialog.js"></script>
<script type="text/javascript" src="../js/iframeTools.source.js"></script>

<div class="tab-div">
  <div id="tabbar-div">
    <p>
      <span class="tab-front" id="general-tab">基本信息</span><span
      class="tab-back" id="detail-tab">详细内容</span>
    </p>
  </div>
  
   <div id="tabbody-div">
<form method="post" action="rg_storelist.php" name="theForm" enctype="multipart/form-data" onsubmit="return validate()">
    <table width="90%" id="general-table">
        <tr>
            <td class="label"><label>店铺名称</label></td>                   
            <td><input type="text" class="put" name="name" id="name" value="{$store.name}" /></td>
        </tr>
        <tr>
            <td class="label"><label>所在地区</label></td>
            <td>
	            <select onchange="wpxLib.dst(this,2)" name="id_province" id="id_province" class="put">
		            	<option value="-1">请选择</option>
		            	{foreach from=$regionlist item=list}
		            		<option value="{$list[region_id]}"{if $list.region_id == $store.id_province} selected{/if}>{$list[region_name]}</option>
		            	{/foreach}
	            </select>
            </td>
        </tr>
        <tr>
            <td class="label"><label>联系电话</label></td>
            <td><input type="text" class="put" name="phone" id="phone" value="{$store.phone}" /></td>
        </tr>
        <tr>
            <td class="label"><label>联系QQ</label></td>
            <td><input type="text" class="put" name="qq" id="qq" value="{$store.qq}" /></td>
        </tr>
        <tr>
            <td class="label"><label>联系地址</label></td>
            <td><input type="text" class="put" name="address" id="address" value="{$store.address}" /></td>
        </tr>
        <tr>
            <td class="label"><label>工作时间</label></td>
            <td><input type="text" class="put" name="worktime" id="worktime" value="{$store.worktime}" /></td>
        </tr>
        <tr>
            <td class="label"><label>地图坐标</label></td>
            <td><input type="text" class="put" name="coordinates" id="coordinates" value="{$store.lng},{$store.lat}" readonly style="float:left;" /><em style="cursor:pointer; padding:2px 10px; border:#CCCCCC solid 1px; color:#F00; float:left; margin-left:10px;" onclick="baidu_opendialog('点击地图','rg_storelist.php?act=baidu_map&id={$store.id}',true,true,'805','455')">点击地图</em></td>
        </tr>
        <tr>
            <td class="label"><label>上传店铺图片</label></td>
            <td>
            	<input type="file" name="store_img" size="35" />
              	{if $store.store_img}
                <img src="images/yes.gif" border="0" />
              	{else}
                <img src="images/no.gif" />
              	{/if}
            </td>
        </tr>
    </table>
    
	<table width="90%" id="detail-table" style="display:none">
     <tr><td>{$FCKeditor}</td></tr>
    </table>

    <div class="button-div">
      <input type="submit" class="button" value="{$lang.button_submit}" />
      <input type="reset" class="button" value="{$lang.button_reset}" />
      <input type="hidden" name="act" value="{$form_action}" />
      <input type="hidden" name="id" value="{$store.id}" />
    </div>
</form>
</div>

<script language="JavaScript">

var store_id = {$store.id|default:0};
var elements  = document.forms['theForm'].elements;
var sz        = new SelectZone(1, elements['source_select'], elements['target_select'], '');

var url="rg_storelist.php?act=api_area", province_id='{if $store.id_province}{$store.id_province}{else}-1{/if}', city_id='{if $store.id_city}{$store.id_city}{else}-1{/if}', dist_id='{if $store.id_dist}{$store.id_dist}{else}-1{/if}';
{literal}
document.forms['theForm'].elements['name'].focus();
onload = function(){
    startCheckOrder();
	
	if(city_id!='-1'){
		$.getJSON(url+'&id='+province_id+'&level=2',function(data){
			var html=wpxLib.buildSelect('id_city',3,data,city_id,'dst');
			$('#id_province').after(html);
		})
	}
	// 解决并发
	setTimeout(function(){
		if(dist_id!='-1'){
			$.getJSON(url+'&id='+city_id+'&level=3',function(data){
				var html=wpxLib.buildSelect('id_dist',4,data,dist_id,'dst');
				$('#id_city').after(html);
			})
		}
	},5); 
}

function validate()
{
    validator = new Validator("theForm");
    validator.required("name",  "输入店铺名称");
    return validator.passed();
}
document.getElementById("tabbar-div").onmouseover = function(e)
{
    var obj = Utils.srcElement(e);

    if (obj.className == "tab-back")
    {
        obj.className = "tab-hover";
    }
}

document.getElementById("tabbar-div").onmouseout = function(e)
{
    var obj = Utils.srcElement(e);

    if (obj.className == "tab-hover")
    {
        obj.className = "tab-back";
    }
}

document.getElementById("tabbar-div").onclick = function(e)
{
    var obj = Utils.srcElement(e);

    if (obj.className == "tab-front")
    {
        return;
    }
    else
    {
        objTable = obj.id.substring(0, obj.id.lastIndexOf("-")) + "-table";

        var tables = document.getElementsByTagName("table");
        var spans  = document.getElementsByTagName("span");

        for (i = 0; i < tables.length; i++)
        {
            if (tables[i].id == objTable)
            {
                tables[i].style.display = (Browser.isIE) ? "block" : "table";
            }
            else
            {
                tables[i].style.display = "none";
            }
        }
        for (i = 0; spans.length; i++)
        {
            if (spans[i].className == "tab-front")
            {
                spans[i].className = "tab-back";
                obj.className = "tab-front";
                break;
            }
        }
    }
}

function baidu_opendialog(title,url,lock,fixed,width,height,top,left){ 
	rg_Dialog= art.dialog.open(url,{ lock:lock, fixed:fixed, title:title, width:width, height:height, top:top, left:left, padding:0, ok: function () { return true; },cancel: function () { document.getElementById('coordinates').value = ''; return true; }});
}
{/literal}
</script>

{include file="pagefooter.htm"}